﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;
using printer;

namespace employeetest
{
    [TestFixture]
    public class employeetest
    {

        Employee temp = new Employee();
        Employee test_employee = new Employee();

        [Test]
        public void employee_test()
        {

            test_employee.User_Name = "ahmed";
            test_employee.PassWord = "1236";
            Assert.That(temp.login(ref test_employee), Is.EqualTo(true));
        }
        [Test]
        public void employee_test_NULL()
        {
            test_employee.User_Name = "";
            test_employee.PassWord = "";
            Assert.IsFalse(temp.login(ref test_employee), "null value enter");
        }
        [Test]
        public void employee_test_NotSame()
        {
            test_employee.User_Name = "AHYG";
            test_employee.PassWord = "1236";
            Assert.IsFalse(temp.login(ref test_employee), "not found in data base name");
        }
        [Test]
        public void employee_test_WRONG_PASS()
        {
            test_employee.User_Name = "ahmed";
            test_employee.PassWord = "123256";
            Assert.IsFalse(temp.login(ref test_employee), "not found in data base password");
        }
        //public void setup()
        //{

        //    etest.User_Name = "ahmed";
        //    etest.PassWord = "1236";
        //}

        //[Test]
        //public void login_Null()
        //{



        //    Assert.IsTrue(etest.login(ref etest));


        //}
        //[Test]
        //public void login_value1()
        //{

        //    etest.User_Name = "ahmed";
        //    etest.PassWord = "1236";
        //    Assert.IsTrue(etest.login(ref etest));

        //}

        [Test]
        public void Linked_Link_Studio_With_owner_null()
        {
            int x = 0;
            int y = 0;
            Assert.IsFalse(test_employee.Link_Studio_With_owner(x, y));


        }
        [Test]
        public void Linked_Link_Studio_With_owner_same()
        {
            int x = 6;
            int y = 6;
            Assert.IsFalse(test_employee.Link_Studio_With_owner(x, y));


            }
        [Test]
        public void Linked_Link_Studio_With_owner_diferent()
        {
            int x = 4;
            int y = 3;
            Assert.IsTrue(test_employee.Link_Studio_With_owner(x, y));


        }
            //[Test]
            //public void Linked_Link_Studio_With_owner_far()
            //{
            //    int x = 100;
            //    int y = 101;
            //    Assert.IsTrue(etest.Link_Studio_With_owner(x, y));


            //}
        [Test]
        public void AddPerson_CheckQuery()
        {
            person x = new person();
            x.Addres = "alex";
            x.Name = "test";
            x.Person_type_id = 2;
            x.phone = "123456789";
            Assert.AreNotEqual(-1, test_employee.AddPersonDB(x));
        }

        [Test]
        public void AddPerson_null()
        {
            person x = new person();
            x.Addres = "";
            x.Name = "";
            x.Person_type_id = 2;
            x.phone = "";
            Assert.AreEqual(-1, test_employee.AddPersonDB(x));
        }
        [Test]
        public void get_person_name_null()
        {
            List<string> user_list = new List<string>();
            user_list=test_employee.get_persons_names(55); // any number not save in database
            Assert.AreSame("not found that kind", user_list[0]);
        }

        [Test]
        public void delete_studio()
        {


            Assert.AreEqual(-1, test_employee.Delete_studio(45)); // any id not saved in database
        }
        [Test]
        public void delet_studio_tDeleted()
        {
            Assert.AreEqual(-1, test_employee.Delete_studio(2));
        }
        [Test]
        public void delet_owner()
        {
            Assert.IsFalse(test_employee.delete_studio_owner(52));
        }

        [Test]
        public void change_passwoered_invalidId()
        {

            Assert.IsFalse(test_employee.change_password(33, "1235", "1456")); // invalid employee id
        
        }
        [Test]
        public void change_passwoered_invalidCurrentPass()
        {

            Assert.IsFalse(test_employee.change_password(3, "1234", "1456")); //invalide current password

        }
    }
}
